﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Web;
using System.Collections.Specialized;

namespace MAF
{
    /// <summary>
    /// 查询集合类
    /// </summary>
    public class Query : IQuery
    {
        /// <summary>
        /// Criterion 集合
        /// </summary>
        private List<IQuery> _Items = new List<IQuery>();

        #region 方法

        /// <summary>
        /// 增加查询条件
        /// </summary>
        /// <param name="q"></param>
        public void Add(IQuery q)
        {
            _Items.Add(q);
        }

        /// <summary>
        /// 是否匹配
        /// </summary>
        /// <param name="o"></param>
        /// <returns></returns>
        public bool IsMatch(object o)
        {
            foreach (var item in _Items)
            {
                var b = item.IsMatch(o);
                if (b)
                {
                    return true;
                }
            }
            return false;
        }

        #endregion
    }
}
